package com.example.chenjun.myapplication.activity;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;

import com.example.chenjun.myapplication.net.NetManager;
import com.example.chenjun.myapplication.widget.LoadingDialog;

public abstract class BaseActivity extends AppCompatActivity {

    protected Context mContext;
    protected LoadingDialog mLoadingDialog;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mContext = this;
        setContentView(getResId());
        mLoadingDialog = new LoadingDialog(this);
    }

    protected abstract int getResId();

    @Override
    protected void onDestroy() {
        super.onDestroy();
        NetManager.singleTon().removeAtActivity(this);
    }
}
